<template>
  <div class="shop_code">
    <!-- <div class="warn-box">
      <svg-icon
        style="margin-right: 17px"
        icon-class="warn"
        :size="20"
      />
      <p class="color-666"><span
        class="font-16"
        style="line-height:35px"
      >蚂蚁链开关</span><br>1. 开启蚂蚁链将会收取一定费用，不开启则不收费。<br>
        2.开启投保必定要开启蚂蚁链，关闭蚂蚁链将同时关闭投保。<br>
        3.只有开启后产生的订单会进行上链操作，开启前和关闭后产生的订单均不会上链。</p>
    </div> -->
    <div class="flex align-center">
      <el-row :gutter="20">
        <el-col :span="24">
          <div class="flex">
            <label style="line-height:40px;margin-right:20px">自动收货天数:</label>
            <div class="flex-1">
              <el-select
                v-model="day_id"
                style="width:100px;margin-bottom:10px"
                clearable
                @change="TWCAndPolicyChange(1)"
              >
                <el-option
                  v-for="item in dnum"
                  :key="item.id"
                  :label="item.label"
                  :value="item.id"
                />
              </el-select>
            </div>
          </div>
        </el-col>
      </el-row>
      <!-- <el-row style="margin-left:100px" :gutter="20">
        <el-col :span="24">
          <div class="flex">
            <label style="line-height:40px;margin-right:20px">是否开启自动投保:</label>
            <div class="flex-1">
              <el-select
                v-model="viewForm.isCanPolicy"
                style="width:100px;margin-bottom:10px"
                clearable
                @change="TWCAndPolicyChange(2)"
              >
                <el-option
                  label="开启"
                  :value="0"
                />
                <el-option
                  label="关闭"
                  :value="1"
                />
              </el-select>
            </div>
          </div>
        </el-col>
      </el-row> -->
    </div>
    <el-button
      type="primary"
      @click="save"
    >保存</el-button>
  </div>
</template>

<script>
import { getAutoGetItem, setAutoGetItem } from '@/api/account'
export default {
  data() {
    return {
      day_id: 0,
      dnum: [
        { id: 7, label: '7天' },
        { id: 8, label: '8天' },
        { id: 9, label: '9天' },
        { id: 10, label: '10天' },
        { id: 11, label: '11天' },
        { id: 12, label: '12天' },
        { id: 13, label: '13天' },
        { id: 14, label: '14天' },
        { id: 15, label: '15天' }
      ]
    }
  },
  mounted() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      getAutoGetItem().then(res => {
        this.day_id = res.day_id
      })
    },
    save() {
      setAutoGetItem(this.day_id).then(res => {

      })
    },
    TWCAndPolicyChange(type) {
      // if (type == 1) {
      //   if (this.viewForm.isCanTWC == 1) {
      //     this.viewForm.isCanPolicy = 1
      //   }
      // } else {
      //   if (this.viewForm.isCanPolicy == 0) {
      //     this.viewForm.isCanTWC = 0
      //   }
      // }
    }
  }
}
</script>
<style lang="scss" scoped>
.shop_code {
  padding: 20px 30px;
  background-color: #f5f5f5;
}
</style>
